package com.yatush.prepare.jsp;
import org.dom4j.Document;
import org.dom4j.DocumentHelper;
import org.dom4j.Element;
import org.dom4j.Node;

import com.yatush.prepare.jsp.markers.BodyAble;
import com.yatush.prepare.jsp.markers.HeadAble;

public class JspDocument{
	
	private Document document;
	private Element html;
	private Element head;
	private Element body;
	
	public JspDocument() {
		document = DocumentHelper.createDocument();
		
		
		html = document.addElement("html");
		head = html.addElement("head");
		body = html.addElement("body");
	}
	
	public void addToHead(HeadAble jspElement){
		head.add(jspElement.getDomElement());
	}
	
	public void addToBody(BodyAble jspElement){
		body.add(jspElement.getDomElement());
	}
	
	@Override
	public String toString() {
		return document.asXML();
	}
}
